package verify

import (
	"github.com/go-playground/validator/v10"
	models "HeadLineNews/proto_models/app/account_model"
)

// registerUserRequestValidation 用户注册 eqfield
func registerUserRequestValidation() {
	validate.RegisterStructValidation(func(sl validator.StructLevel) {
		if s, ok := sl.Current().Interface().(models.RequestUserRegister); ok {
			if s.UserPwd != s.PwdRepeat {
				sl.ReportError(
					nil,
					"pwdRepeat",
					"",
					"eqfield",
					"userPwd",
				)
			}
		}

	}, models.RequestUserRegister{})
}
